package cn.cdeden.common.translation.core.impl;

import cn.cdeden.common.translation.annotation.TranslationType;
import cn.cdeden.common.translation.constant.TransConstant;
import cn.cdeden.common.translation.core.TranslationInterface;
import cn.cdeden.resource.api.RemoteFileService;
import cn.cdeden.resource.api.domain.RemoteFile;
import lombok.AllArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;

/**
 * TODO
 *
 * @author Administrator
 * @date 2025/2/7 15:04
 * @describe:
 **/
@AllArgsConstructor
@TranslationType(type = TransConstant.OSS_ID_TO_FILE_NAME)
public class OssIdToFileNameTranslationImpl implements TranslationInterface<String> {
    @DubboReference(mock = "true")
    private RemoteFileService remoteFileService;
    @Override
    public String translation(Object key, String other) {
        RemoteFile remoteFile = remoteFileService.selectById(key.toString());
        return remoteFile.getOriginalNameInfo();
    }
}
